
const ipcRenderer = require('electron').ipcRenderer;


const app = Vue.createApp({
    data(){
        return {
            form : {
                host : localStorage.getItem('index:form:host') || '',
                port : localStorage.getItem('index:form:port') || '',
            },
            loading : false
        }
    },
    mounted(){
        ipcRenderer.on('open', (e, data) => {
            this.loading = false
            if(data){
                let a = document.createElement('a')
                a.href = './linkList.html'
                a.click()
            }else{
                this.$message.error('链接失败')
            }
        })
    },
    methods : {
        open(){

            localStorage.setItem('index:form:host', this.form.host)
            localStorage.setItem('index:form:port', this.form.port)

            this.loading = true
            ipcRenderer.send('open', {...this.form})
        }
    }
})

app.use(ElementPlus)

app.mount('#app')


